//
// Created by mi on 2024/5/6.
//
#include <iostream>
#include <string>
#include <unordered_map>

using namespace std;

int main() {
    //创建空容器
    std::unordered_map<std::string, std::string> myummap;
    //向空容器中连续添加 5 个键值对
    myummap.emplace("Abc", "http://c.biancheng.net");
    myummap.emplace("Abc", "http://c.haha.net/c/");
    myummap.emplace("Python", "http://c.biancheng.net/python/");
    myummap.emplace("STL", "http://c.biancheng.net/stl/");
    myummap.emplace("Java", "http://c.biancheng.net/java/");
    myummap.emplace("Java", "http://c.ww.net/java/");

    //输出 muummap 容器存储键值对的个数
    //利用迭代器输出容器中存储的所有键值对
//    for (auto iter = myummap.begin(); iter != myummap.end(); ++iter) {
//        cout << iter->first << " " << iter->second << endl;
//    }

    for (auto it = myummap.find("STL"); it != myummap.end()&& it->first == "STL"; ++it) {
        std::cout << "找到了 " << it->first << ' ' << it->second << std::endl;
    }
    return 0;
}